import request from "@/utils/request"

const BASE_URL_AUTH = process.env.VUE_APP_BASE_URL_AUTH
const BASE_URL_ADMIN = process.env.VUE_APP_BASE_URL

export function loginAPI(params) {
	return request({
		url: BASE_URL_AUTH + "/login",
		method: "post",
		data: params,
		customConfig: {
			removeToken: true
		},
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

export function logoutAPI() {
	return request({
		url: BASE_URL_AUTH + "/logout",
		method: "post"
	})
}

/**
 * 获取短信验证码
 * @param params
 */
export function sendSmsAPI(params) {
	return request({
		url: BASE_URL_ADMIN + "cloud/sendSms",
		method: "post",
		data: params
	})
}

/**
 * 注册
 * @param params
 */
export function registerAPI(params) {
	return request({
		url: BASE_URL_AUTH + "cloud/register",
		method: "post",
		data: params,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 完善注册
 * @param params
 */
export function serverRegisterAPI(params) {
	return request({
		url: BASE_URL_AUTH + "cloud/serverRegister",
		method: "post",
		data: params,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 多公司选择登陆
 * @param params
 */
export function chooseLoginAPI(params) {
	return request({
		url: BASE_URL_AUTH + "reLogin",
		method: "post",
		data: params,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 找回密码
 * @param params
 */
export function forgetPwdAPI(params) {
	return request({
		url: BASE_URL_AUTH + "cloud/findpwd",
		method: "post",
		data: params
	})
}

/**
 * 重置密码
 * @param params
 */
export function resetPwdAPI(params) {
	return request({
		url: BASE_URL_AUTH + "cloud/resetpwd",
		method: "post",
		data: params
	})
}

/**
 * 验证短信验证码
 * @param params
 */
export function verfySmsAPI(params) {
	return request({
		url: BASE_URL_ADMIN + "cloud/verifySms",
		method: "post",
		data: params
	})
}

/**
 * 验证
 * @param params
 */
export function verfyCodeAPI(params) {
	return request({
		url: BASE_URL_AUTH + "verfyCode",
		method: "post",
		data: params
	})
}

/**
 * 获取公司logo
 * @param params
 */
export function doLoginGetLoGoAPI(params) {
	return request({
		url: BASE_URL_AUTH + "/doLoginGetLoGo",
		method: "post",
		data: params,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 重置主账号手机号
 * @param params
 */
export function resetManagerUserAPI(params) {
	return request({
		url: BASE_URL_AUTH + "adminCompanyManager/resetManagerUser",
		method: "post",
		data: params,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}
